<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>em与rem的关系</title>
    <style>
        html,
        body {
            font-size: 20px;
        }

        #demo1 {
            width: 400px;
            height: 400px;
            background-color: skyblue;
            font-size: 40px;
        }

        #demo2 {
            width: 10rem;
            height: 10rem;
            background-color: gray;
        }
    </style>
</head>

<body>
    <!-- em是相对父元素font-size的字体大小 -->
    <!-- rem是相对根元素font-size的字体大小，而根元素默认字体大小是16px -->

    <div id="demo1">
        <div id="demo2"></div>
    </div>
</body>

</html>